<?php
namespace app\admin\validate;
use think\Validate;

class CateGory extends Validate
{
	public $rule = [
        'category_name|分类名'=>['require','unique:CateGory'],
        'parent_id|父类'=>['checkParentId']
    ];

    
     protected function checkParentId($parent_id){

     	 if(input('?id') && $parent_id == input('id') ){

     	 	return 'parent_id error';
     	 }
     
       return true;
  
    }
}